import request from '@/utils/request'
export function fetchList(parentId,params) {
  return request({
    url:'/productCategory/list/'+parentId,
    method:'get',
    params:params
  })
}
export function deleteProductCate(id) {
  return request({
    url:'/productCategory/delete/'+id,
    method:'post'
  })
}

export function createProductCate(data) {
  let datas = new URLSearchParams();
  Object.keys(data).forEach(function(key){
    datas.append(key,data[key]);
});
  return request({
    url:'/productCategory/create',
    method:'post',
    data:datas
  })
}

export function updateProductCate(id,data) {
  let datas = new URLSearchParams();
  Object.keys(data).forEach(function(key){
    datas.append(key,data[key]);
});
  return request({
    url:'/productCategory/update/'+id,
    method:'post',
    data:datas
  })
}

export function getProductCate(id) {
  return request({
    url:'/productCategory/'+id,
    method:'get',
  })
}

export function updateShowStatus(data) {
  return request({
    url:'/productCategory/update/showStatus',
    method:'post',
    data:data
  })
}

export function updateNavStatus(data) {
  return request({
    url:'/productCategory/update/navStatus',
    method:'post',
    data:data
  })
}

export function CategoryList() {
  return request({
    url:'/productCategory/list',
    method:'get'
  })
}

export function GoodsProperties(id) {
  return request({
    url:'/product/properties/'+id,
    method:'get'
  })
}

export function GoodsPropertiesActiveChange(goodsId,prId) {
  let data = new URLSearchParams();
    data.append('goodsId',goodsId);
    data.append('prId',prId);
  return request({
    url:'/product/properties/update',
    method:'post',
    data:data
  })
}

export function RemoveProperties(goodsId,prId) {
  let data = new URLSearchParams();
    data.append('goodsId',goodsId);
    data.append('prId',prId);
  return request({
    url:'/product/RemoveProperties',
    method:'post',
    data:data
  })
}


export function AddProductProperties(goodsId,data) {
  let datas = new URLSearchParams();
  Object.keys(data).forEach(function(key){
    datas.append(key,data[key]);
});
  datas.append('goodsId',goodsId)
  return request({
    url:'/product/AddProductProperties',
    method:'post',
    data:datas
  })
}


